<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2020/6/28
 * Time: 14:54
 */

namespace app\common\model\mall;

use app\common\model\TimeModel;


class Net extends TimeModel
{
    protected $deleteTime = 'delete_time';

    //课程所属分类
    public function category()
    {
        return $this->belongsTo('app\common\model\common\Categories','category_id','id')->field('id,name');
    }
    //与课程标签多对多关联
    public function tags()
    {
        return $this->belongsToMany('app\common\model\common\Tags','relation_tag','other_id','tag_id');
    }
    //网上课程下所有的附件
    public function items()
    {
        return $this->hasMany('app\common\model\mall\NetItem','article_id','id')->field('id,article_id,video,work,sort');
    }
}